<template>
  <div class="help-center">
    <div class="help-img">
      <img src="../../static/help.png" alt="" />
    </div>
    <el-divider></el-divider>
    <div class="list">
      <div class="item" v-for="(item, index) in questions" :key="index">
        <!-- 一级标题 -->
        <div class="question" :style="index === 0 ? { marginTop: 0 } : null"
        @click="clickQuestions(index)">
        <i :class="[index === active ? 'el-icon-arrow-up' : 'el-icon-arrow-down']"></i>
          {{ item.question }}
        </div>
        <!-- 通过active控制整体出现 -->
        <!-- 二级标题 -->
        <div v-if="index === active">
          <div v-for="(every, i) in item.list" :key="i">
            <div class="title" @click="clickTitle(i)">{{ every.title }}</div>

            <el-divider v-if="i < item.list.length - 1 || i === active1"></el-divider>
            <!-- 通过active1控制小内容出现 -->
            <!-- 三级内容 -->
            <div v-if="i === active1">
              <div class="content">{{ every.content }}</div>
            <el-divider v-if="i < item.list.length - 1"></el-divider>
            </div>
            
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  props:{ 
    questions: {
      type: Array
    }
  },
  data() {
    return {
      active: 0,
      active1: 0,
    };
  },
  methods: {
    clickQuestions(index) {
      this.active = index
      this.active1 = 0
    },
    clickTitle(i) {
      this.active1 = i
    }
  },
};
</script>
<style scoped>
.help-img {
  padding: 3% 0 0 3%;
}
.help-img img {
  width: 30%;
}
.list div {
  cursor: pointer;
}
.question {
  padding: 2% 5%;
  font-size: 0.16rem;
  background-color: rgb(229, 0, 18);
  box-shadow: 0px 0.045rem 0.045rem rgba(229, 0, 18, .25);
  color: #ffff;
  margin-top: 1%;
}
.title {
  padding: 2% 6%;
  font-size: 0.14rem;
  font-weight: 550;
  position: relative;
}
.title::before {
  position: absolute;
  content: "";
  width: 0.03rem;
  height: 0.03rem;
  background-color: #000;
  border-radius: 50%;
  left: 5%;
  top: 50%;
  transform: translateY(-50%);
}
.content {
  padding: 2% 6%;
  color: rgb(143, 143, 143);
  font-size: 0.13rem;
  font-weight: 500;
}
</style>
<style>
.help-center .el-divider--horizontal {
  margin: 0;
}
</style>